import json
import VRF_Env.Tools.Message_Class as mess
import VRF_Env.Tools.Socket as soc

class remote_env:
    def __init__(self):
        Config = json.load(open('config.json'))
        self.IPaddress = Config['IPaddress']
        self.Port = Config['Port']

    def connect(self):
        self.clientsoc=soc.Socket_Client(self.IPaddress,int(self.Port))
        receive=self.clientsoc.Connect()
        print('连接成功'+receive)

    def reset(self):
        print('环境初始化')
        message = mess.Send_mess()
        message.set_command(1)
        ob_rec = self.clientsoc.Send_Receive(message)
        ob = list(eval(ob_rec))
        return ob

    def FirstStep(self, ):
        message = mess.Send_mess()
        message.set_command(2)

    def Step(self):
        pass

    def Render(self):
        pass

a=remote_env()
a.connect()